/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

#include "sle_lite_tool_test.h"

static void SleTestToolHalper(void)
{
    printf("*****SleTestTool Command List*******\r\n");
    for (uint16_t i = 0; i < g_sleTestCmdNum; i++) {
        printf("*     %02d - %-20s     *\r\n", i, g_sleTestCmdList[i].desc);
    }
}

void SleTestToolCmdHandler(int argc, char **argv)
{
    printf("SleTestToolCmdHandler in\r\n");
    //试配uart接口的调用方式
    SleResetEnv();
    //从函数名字之后开始处理参数列表
    SleSetBufEnv(argc, argv, 1);
    int index = SleGetInputNumber("Please input cmd index:\r\n");
    if(index < g_sleTestCmdNum) {
        printf("cmd: %d\r\n", index);
        printf("Execute: %s\r\n", g_sleTestCmdList[index].desc);
        g_sleTestCmdList[index].func();
    }
    if(index != 0) g_sleTestCmdList[0].func();
}

#ifdef __cplusplus
}
#endif // __cplusplus
